import { request } from '../api/request';

const url = import.meta.env.VITE_APP_API_BASE_URL
console.log("接口url", url)

// 签名
export const generateUserSigApi = (params) => {
  return request(
    url + "/im/generateUserSig",
    "post",
    params
  )
}


export const getOpenIdLogin = (params) => {
  return request (
    url + "/health-user-center/auth/wx/sns/jscode2session/login",
    'post',
    params,
  );
}

// 根据code获取openid
export const getOpenId = (params) => {
  return request (
    url + "/health-user-center/auth/wx/sns/jscode2session",
    'post',
    params,
  );
}

// 获取token by OpenId
export const getTokenByOpenId = (params) => {
  return request (
    url + "/health-user-center/auth/wx/verify/phonenumber",
    'post',
    params,
  );
}

//微信获取手机号
export const getUserPhoneNumber = (params) => {
  return request (
    url + "/health-user-center/auth/wx/send/code",
    'post',
    params,
  );
}

// 发送手机验证码
export const getTelCode = (params) => {
  return request (
    url + "/health-user-center/auth/send/otp/code",
    'post',
    params,
  );
}

// 登陆
export const telCodeLogin = (params) => {
  return request (
    url + "/health-user-center/auth/sign/in",
    'post',
    params,
  );
}

// 退出登录
export const userLogout = () => {
  return request (
    url + "/health-user-center/auth/logout",
    'post'
  );
}

// 登录日志
export const accountLog = (params) => {
  return request (
    url + "/health-user-center/account/log/save",
    'post',
    params
  );
}

// 获取用户信息
export const getUserInfo = (accountId) => {
  return request (
    url + `/health-user-center/user/info/get?accountId=${accountId}`,
    'get'
  );
}

// 保存用户资料
export const saveUserInfo = (params) => {
  return request (
    url + "/healthbot-sport/customer/save",
    'post',
    params
  );
}

// 聊天
export const modelChat = url + "/healthbot-sport/chat/modelChat"

// 话术提示
export const promptTrick = url + "/healthbot-sport/chat/promptTrick"

// 开始跑步
export const createMileage = (params) => {
  return request(
    url + "/healthbot-sport/mileage/create",
    "post",
    params
  )
}

// 更新距离和时间
export const updateMileage = (params) => {
  return request(
    url + "/healthbot-sport/mileage/update",
    "post",
    params
  )
}

// 里程记录
export const listMileage = (params) => {
  return request(
    url + "/healthbot-sport/mileage/list",
    "post",
    params
  )
}

// 里程结束
export const endMileage = (params) => {
  return request(
    url + "/healthbot-sport/mileage/endMileage",
    "post",
    params
  )
}

// 保存手机埋点
export const burialPointTel = (params) => {
  return request(
    url + "/healthbot-sport/burialPoint/savePhoneInfo",
    "post",
    params
  )
}

// 保存弱网埋点
export const burialWeakNetworkInfo = (params) => {
  return request(
    url + "/healthbot-sport/burialPoint/saveWeakNetworkInfo",
    "post",
    params
  )
}

// biz参数
export const getBizParam = (params) => {
  return request(
    url + `/healthbot-sport/chat/getBizParam?userId=${params}`,
    "get"
  )
}

// 文本监测
export const textCensorChat = (params) => {
  return request(
    url + "/healthbot-sport/chat/textCensor",
    "post",
    params
  )
}

// 体检
export const physicalExamination = (params) => {
  return request(
    url + "/healthbot-sport/physicalExamination/list",
    "post",
    params
  )
}

// 配置列表
export const getConfigList = (params) => {
  return request(
    url + "/healthbot-sport/config/getConfigList",
    "post",
    params
  )
}

// 查询时间
export const getMileageRecordData = (params) => {
  return request(
    url + "/healthbot-sport/mileage/recordData",
    "post",
    params
  )
}

// 创建分享
export const createShare = (params) => {
  return request(
    url + "/healthbot-sport/share/create",
    "post",
    params
  )
}

// 猜你想问初始化
export const initPresetQuestion = (params) => {
  return request(
    url + "/healthbot-sport/modelPresetQuestion/init",
    "post",
    params
  )
}

// 猜你想问问题
export const listPresetQuestion = (params) => {
  return request(
    url + "/healthbot-sport/modelPresetQuestion/list",
    "post",
    params
  )
}

// 获取运动记录详情
export const mileageDetail = (params) => {
  return request(
    url + "/healthbot-sport/mileage/detail",
    "post",
    params
  )
}

// 更新运动轨迹
export const updatePathImg = (params) => {
  return request(
    url + "/healthbot-sport/mileage/updatePathImg",
    "post",
    params
  )
}

// 功能反馈
export const createFeedback = (params) => {
  return request(
    url + "/healthbot-sport/problemFeedback/create",
    "post",
    params
  )
}

// 功能反馈
export const getOssSign = (uuid) => {
  return request(
    url + `/healthbot-sport/oss/getSign?name=${uuid}`,
    "get",
  )
}

// 入团判断
export const groupJudgeJoin = (params) => {
	return request(
		url + `/healthbot-sport/group/judgeJoin`,
		"post",
		params
	)
}

// 查询团信息 根据userId
export const getGroupInfo = (userId) => {
	return request(
		url + `/healthbot-sport/group/info?userId=${userId}`,
		"get",
	)
}

// 查询团信息 根据团id
export const getGroupInfoByGroupId = (params) => {
	return request(
		url + `/healthbot-sport/group/getGroupInfo`,
		"post",
    params
	)
}

// 排行榜
export const getGroupRank = (params) => {
	return request(
		url + `/healthbot-sport/group/groupRank`,
		"post",
		params
	)
}

// 上传
export const uploadFile = url + `/healthbot-sport/oss/uploadFile`

// 加入跑团
export const joinGroup = (params) => {
	return request(
		url + `/healthbot-sport/group/joinGroup`,
		"post",
		params
	)
}

// 团成员
export const groupMemberList = (params) => {
  return request(
    url + `/healthbot-sport/group/groupMemberList`,
    "post",
    params
  )
}

// 转让团长
export const transferCommander = (params) => {
  return request(
    url + `/healthbot-sport/group/transferCommander`,
    "post",
    params
  )
}
// 移除团成员
export const deleteGroupMember = (params) => {
  return request(
    url + `/healthbot-sport/group/removeMember`,
    "post",
    params
  )
}

// 创建跑团
export const createGroupInfo = (params) => {
  return request(
    url + `/healthbot-sport/group/createGroupInfo`,
    "post",
    params
  )
}
// 编辑跑团
export const updateGroupInfo = (params) => {
  return request(
    url + `/healthbot-sport/group/updateGroupInfo`,
    "post",
    params
  )
}

// 更新语音配置
export const broadcastUpdate = (params) => {
  return request(
    url + `/healthbot-sport/broadcast/set`,
    "post",
    params
  )
}

// 查询语音配置
export const broadcastGet = (params) => {
  return request(
    url + `/healthbot-sport/broadcast/getSwitchOff?userId=${params}`,
    "get"
  )
}

// bmi查询
export const getBmiReport = (params) => {
  return request(
    url + `/healthbot-sport/report/bmiReport`,
    "post",
    params
  )
}

// 运动报告图查询
export const getSportReport = (params) => {
  return request(
    url + `/healthbot-sport/sportReport/popupInfo`,
    "post",
    params
  )
}

// 运动报告数据查询
export const getSportReportData = (params) => {
  return request(
    url + `/healthbot-sport/sportReport/getSportReport`,
    "post",
    params
  )
}

// 首页建议
export const getChatAdvice = (params) => {
  return request(
    url + `/healthbot-sport/chat/getAdvice`,
    "post",
    params
  )
}

// 跑团点赞
export const createGroupLike = (params) => {
  return request(
    url + `/healthbot-sport/groupLike/create`,
    "post",
    params
  )
}


